<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="讯都" />
	<meta name="description" content="讯都" />
	<title>讯都新闻模块</title>
	<link rel="stylesheet" href="../css/css/base.css" type="text/css"/>
	<link rel="stylesheet" href="../css/css/style.css" type="text/css"/>
	<style type="text/css">
		.pagebox
		{
			margin-top: 40px;
		}
		.pagebox .cur
		{
			background: #DC0000;
			color: #fff;
			border-color: #dc0000;
		}
		.pagebox .pageRemark
		{
			margin: 20px 0px;
		}
		.pagebox .pageRemark b
		{
			color: #dc0000;
		}
	</style>
</head>
<body>
	<?php
		require('tance.php');
	?>
	<div class="menu-index">
		<div class="content">
			<div class="menu-list ovfl_hid">
				<a href="index.php" class="active">首页</a>
				<?php
				$desc=$db->query("select * from type_admin where parentid=0");
				while($row=$desc->fetch_assoc()){
				?>
				<a href="module.php?id=<?php echo $row['id'];?>&&pid=<?php echo $row['id'];?>&&sid=<?php echo $row['id'];?>"><?php echo $row['type_name'];?></a>
			<?php }?>
			</div>
		</div>
	</div>
	<div class="main">
		<div class="content ovfl_hid">
			<!--<img src="img/banner_title2.png" class="wid_dis banner-little"/>-->
			<div class="module-left left">
				<div class="module-banner-box ovfl_hid">
					<div class="module-banner-left left">
						<img src="../css/img/banner_big1.png" class="wid_dis" />
					</div>
					<div class="module-banner-right right">
						<div class="module-bannerR-item">
							<img src="../css/img/0026Bxt7HMp4.png" class="wid_dis" />
						</div>
						<div class="module-bannerR-item">
							<img src="../css/img/0319q8YXSkts.png" class="wid_dis" />
						</div>
						<div class="module-bannerR-item">
							<img src="../css/img/0726M4EGcYWa.png" class="wid_dis" />
						</div>
					</div>
				</div>
				<div class="module-menu-box ovfl_hid">
					<?php
						$pid=$_GET['pid'];
						$type=$db->query("select * from type_admin where parentid=".$pid."");
						$erji=$type->fetch_assoc();
						if(empty($_GET['yid'])){
					?>
					<!-- <a href="module.php?id=<?php echo $erji['id'];?>&&pid=<?php echo $erji['parentid'];?>&&yid=<?php echo $erji['id'];?>" class="active">全部</a> -->
					<a href="index.php" class="active">全部</a>
					<?php }else{ ?>
							<!-- <a href="module.php?id=<?php echo $erji['id'];?>&&pid=<?php echo $erji['parentid'];?>&&yid=<?php echo $erji['id'];?>">全部</a> -->
							<a href="index.php">全部</a>
					<?php }?>
					<?php
						$pid=$_GET['pid'];
						$type=$db->query("select * from type_admin where parentid=".$pid."");
						while ($erji=$type->fetch_assoc()){
							if(empty($_GET['yid'])){
					?>	
						<a href="module.php?id=<?php echo $erji['id'];?>&&pid=<?php echo $erji['parentid'];?>&&yid=<?php echo $erji['id'];?>&&sid=<?php echo $erji['id'];?>"><?php echo $erji['type_name'];?></a>
						<?php }else{ 
							if($_GET['yid']==$erji['id']){ ?>
						<a href="module.php?id=<?php echo $erji['id'];?>&&pid=<?php echo $erji['parentid'];?>&&yid=<?php echo $erji['id'];?>&&sid=<?php echo $erji['id'];?>" class="active"><?php echo $erji['type_name'];?></a>
						<?php }else{?>
						<a href="module.php?id=<?php echo $erji['id'];?>&&pid=<?php echo $erji['parentid'];?>&&yid=<?php echo $erji['id'];?>&&sid=<?php echo $erji['id'];?>"><?php echo $erji['type_name'];?></a>
					<?php }}}?>
				</div>
				<ul class="module-news-list">
					<?php
						$id= $_GET['id'];
						// var_dump($id);die;
						if(empty($_GET['yid'])){
							$desc=$db->query("select * from ".$new." where ".$new.".superior_id=$id");
						}else{
							$yid=$_GET['yid'];
							$desc=$db->query("select * from ".$new." where ".$new.".type_id=$yid");
						}
						
						require('./page.class.php');
                    	$total = count($desc->fetch_all());
                    	$myde_total = $total;
                    	$myde_size = 10;
                    	//echo $_SERVER['QUERY_STRING'];exit;
                    	if(empty($_GET['id'])){
                       	 $_GET['id'] = 1;
                   	 	}
                   	 	if(empty($_GET['pid'])){
                       	 $_GET['pid'] = 1;
                   	 	}
                    	$para_id = 'id='.$_GET['id'];
                    	if(empty($_GET['page'])){
                        	$_GET['page'] = 1;
                    	}
                    	$para_pid='pid='.$_GET['pid'].'&';
                    	$para_page = '&page={page}';
                    	$sid = '&sid='.$_GET['id'];
                    	$myde_page = $_GET['page'];
                    	$myde_url =  'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$para_pid.$para_id.$para_page.$sid;
                    	$show_pages = 2;
                    	$PAGES = new page($myde_total, $myde_size, $myde_page, $myde_url, $show_pages = 2);
                    	$skip = ($myde_page-1)*$myde_size;
                    	$take = $myde_size;
                    	if(empty($_GET['yid'])){
							$desc=$db->query("select * from ".$new." where ".$new.".superior_id=$id"." limit ".$skip.' , '.$take);
						}else{
							$yid=$_GET['yid'];
							$desc=$db->query("select * from ".$new." where ".$new.".type_id=$yid"." limit ".$skip.' , '.$take);
						}
                    	// $desc=$db->query("select * from ".$new." where ".$new.".superior_id=$id"." limit ".$skip.' , '.$take);
						while($content=$desc->fetch_assoc()){
							// $page=count($content);
						// var_dump($content);die;
					?>
					<li class="module-news-item ovfl_hid">
						<div class="module-news-img left"></div>
						<h2 class="title fw_400 ellipsis"><a href="detail.php?id=<?php echo $content['id'];?>&&tid=<?php echo $content['superior_id'];?>&&sid=<?php echo $content['superior_id'];?>"><?php echo $content['title'];?></a></h2>
						<p class="date fs12_6"><?php echo $content['pubtime'];?>
						<?php if($content['recommended']==1){ ?>
						<span class="recomment">推荐</span>
						<?php }?>
						<?php if($content['is_hot']==1){ ?>
						<span class="hot">热门</span></p>
						<?php }?>
						<p class="intro ellipsis-3 fs14_0"><?php echo $content['duction'];?></p>
					</li>
					<?php }?>
				</ul>
				<div class="pagebox">
                    <?php
                    $page = $PAGES->myde_write();
                    echo $page;
                    ?>
                </div>
			</div>
			<?php
				require('right.php');
			?>
		</div>
	</div>
		<?php
			require('bottom.php');
		?>
	</div>
	<script type="text/javascript" src="../css/js/jquery-1.11.1.js" ></script>
	<script type="text/javascript" src="../css/js/jquery.pagination.js" ></script>
	<script type="text/javascript">
// 		$('.pagebox').pagination({
// 			totalData:100,
// 			showData:5,
// //		    pageCount:50,
// 		    jump:true,
// 		    coping:true,
// //		    homePage:'首页',
// //		    endPage:'末页',
// 		    prevContent:'上页',
// 		    nextContent:'下页',
// 		    callback:function(e){
// 		    	console.log(e.getCurrent());
// 		    }
// 		});
		
	</script>
</body>
</html>
